<%--
 *  File:   BatchNumberEnteringSummary.jsp
 *  @Author: jackyin
 *  Date:    2011/2/17
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>


<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "COM";
 	String strTableName = "v_zylbatchnumberenteringsummary";
 	String privilegeCode = "10350";   
    String contextPath = request.getContextPath(); 
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/inc/NewCalendar.inc" %>
<html>
<head>
<title>MasterdataRelationship</title>
<PageFlow:CheckPageFlow pageName="p_zylbatchnumberenteringsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>

<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
	HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  	if(searchresults == null)
  	{
  		searchresults = new Vector();
  	}
%>



<script language="JavaScript" >
var popwindow;

function page_summary(actionvalue,orderbyname){
  	 var editform = summaryPrepare(cform,actionvalue,orderbyname);
 	 editform.action = "BatchNumberEnteringSummary.jsp?<%= OvalTools.randomURL() %>";
 	 editform.target = "_self";
 	 isRunning = true;
 	 editform.submit();
}

function page_add(){
	 if(!checkForm(document.cform))
		  return;
	 cform.actionname.value = "add";
  	 cform.target = "_self";
  	 isRunning = true;
  	 cform.submit();
}

function page_delete(){
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}


function popBusinessarea(num){
	if(popwindow!=null) popwindow.close();
 	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	
    url = 'BusinessAreaPop.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=500, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
//partner
function popOrgnization(){
	if(popwindow!=null) popwindow.close();
    url = 'OrgBusiness.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=250, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}

//partner
function setOrgBusiness(userid,orgname,orgcode,orgid){
	document.cform.partnerid.value=orgid;
	document.cform.partnername.value=orgname;
	document.cform.partnercode.value=orgcode;
}

//customer
function setCustomBusiness(userid,orgname,orgcode,orgid){
	document.cform.customerid.value=orgid;
	document.cform.customername.value=orgname;
	document.cform.customercode.value=orgcode;
}

//product
function setProductBusiness(userid,prdn,prodcode,prodid){
	document.cform.prodid.value=prodid;
	document.cform.prodname.value=prdn;
	document.cform.prodcode.value=prodcode;
}

function isModify(checkname,num){
	var checkvalue = document.cform[checkname+num].value;
	var oldvalue = document.cform['old'+checkname+num].value;
	if(Trim(checkvalue)==Trim(oldvalue)){
		return false;
	}else{
		return true;
	}
}


function page_save(){
	cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}

//customer
function popCustom(){
	if(popwindow!=null) popwindow.close();
    url = 'CustomBusiness.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=250, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}

//product
function popProduct(){
	if(popwindow!=null) popwindow.close();
    url = 'ProductBusiness.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=250, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
</script>

</head>
<body>

<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_zylbatchnumberenteringsummary">
	<input type="hidden" name="actionname">
	<input type="hidden" name="currentnum"/>
	<input type="hidden" name="flags" value="0">
	<input type="hidden" name="numrows" value="<%=searchresults.size() %>">

	<table width="100%" cellspacing="0" border="0" cellpadding="0">
	
	   	<tr>
	     	<td>
	     		<table width="100%"  border="0" cellspacing="0">  
			        <%@ include file="/inc/SummarySearch.inc" %>
			    </table>
	     	</td>
	    </tr>
	    <tr> 
		    <td> 
		      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="left">
		      	
	    	
		         <tr class="deepblue-left">
				  <td width="25px" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
		          <td class="title_center" width="260px"><a href="javascript:page_summary('orderby','partnercode')"><%= label.getLabelName("L_Dealer") %></a></td>
		          <td class="title_center" width="260px" ><a href="javascript:page_summary('orderby','customercode')"><%= label.getLabelName("L_Customer") %></a></td>
		          <td class="title_center" width="200px" ><a href="javascript:page_summary('orderby','prodcode')"><%= label.getLabelName("L_Product") %></a></td>
		          <td class="title_center" width="100px"><a href="javascript:page_summary('orderby','bunchnopassdate')"><%= label.getLabelName("L_Date") %></a></td>
		          <td class="title_center" width="90px"><a href="javascript:page_summary('orderby','bunchno')"><%= label.getLabelName("L_LotNumber") %></a></td>
		          <td class="title_center" width="90px"><a href="javascript:page_summary('orderby','supervisecode')"><%= label.getLabelName("L_SuperviseCode") %></a></td>
		          <td class="title_center" width="90px"><a href="javascript:page_summary('orderby','password')"><%= label.getLabelName("L_Password") %></a></td>
		        
		        </tr>

		        <%
	            	int i = 0;
	             	String strClassType = new String();
	          	%>
		         <logic:iterate id="onerow" collection="<%= searchresults %>" indexId="idx">
		           	<%
		            	HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
		            	if(i%2 == 1)
		            	{
		              		strClassType = "td-listrom";
		            	}else{
		              		strClassType = "";
		            	}
		            	i++;
		            	
		          	%>
		          	<tr id="tr<%=idx %>" class="none">
		          		<td id="td"  >
		              		<input type="checkbox" name="deleteids" value="<%=JspHelper.filterNull( tempMap.get("bunchnopassinfoid") )%>" class="checkbox">
		            		<custom:hidden property="mdflag" colIndex="<%=idx %>" value="0"/>
		            		<custom:hidden name="onerow" property="bunchnopassinfoid" colIndex="<%=idx %>"/>
		            	</td>
		            	<td >
		            	<custom:write name="onerow" property="partnercode" nbsp="true"/>&nbsp;&nbsp;
		            		<custom:write name="onerow" property="partnername" nbsp="true"/>
		            		<custom:hidden name="onerow" property="partnerid" colIndex="<%=idx %>"/>
		            	</td>
		            	<td >
		            	   <custom:write name="onerow" property="customercode" nbsp="true"/>&nbsp;&nbsp;
		            		<custom:write name="onerow" property="customername" nbsp="true"/>
		            		<custom:hidden name="onerow" property="customerid" colIndex="<%=idx %>"/>
		            	</td>		            	
						<td >
						   <custom:write name="onerow" property="prodcode" nbsp="true"/>&nbsp;&nbsp;
							<custom:write name="onerow" property="prodname" nbsp="true"/>
							<custom:hidden name="onerow" property="prodid" colIndex="<%=idx %>"/>
						</td> 
					<%--
					 <%
                       String strDate = ((pageContext.getAttribute("bunchnopassdate")==null)
                			   	? OvalTools.dateToString(new java.sql.Date(System.currentTimeMillis()), (String)session.getAttribute("dateformat"))
                			   	:(OvalTools.dateToString((java.sql.Date)pageContext.getAttribute("bunchnopassdate"),(String)session.getAttribute("dateformat"))));
                       %>
						
					 --%>
						
                            <td >
                            <custom:hidden name="onerow"  property="bunchnopassdate" changedName="oldbunchnopassdate" colIndex="<%=idx %>"/>
                    <custom:text name="onerow" property="bunchnopassdate" dataType="date" dataFormatName="dateformat"  style="width:140px;" readonly="true"  colIndex="<%=idx %>"/>
                      <a onclick="javascript:c.show(this,'cform.bunchnopassdate<%=idx %>','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
                       </td>
						
						<td >
							<custom:hidden name="onerow" property="bunchno" changedName="oldbunchno" colIndex="<%=idx %>"/>
						    <custom:text name="onerow" property="bunchno" colIndex="<%=idx %>" size="11"/>
		     		    </td>
		     			<td >
						    <custom:text name="onerow" property="supervisecode" colIndex="<%=idx %>" size="11"/>
		     		    </td>
		     			<td >
						    <custom:write name="onerow" property="password" nbsp="true"/>
		     		    </td>
		     		 </tr>
		     	 </logic:iterate>
		     	 
		     	 
		     	 
		     	 <tr class="none">
		           <td>&nbsp;</td>
		           <td >
		           	<custom:hidden name="details" property="partnerid" />
		           	<custom:text name="details" property="partnercode" readonly="true" size="5"></custom:text>
		           	<a onclick="popOrgnization()"><custom:button type="3" label="" value="*"/></a>
		           	<custom:text name="details" property="partnername" readonly="true" size="30" command="notnull" label="L_Dealer"></custom:text>
		           </td>
		           <td >
		           	<custom:hidden name="details" property="customerid" />
					<custom:text name="details" property="customercode" readonly="true" size="5"/>
					<a onclick="popCustom()"><custom:button type="3" value="*"/></a>
					<custom:text name="details" property="customername" readonly="true" size="30" command="notnull" label="L_Customer"/>
		           </td>
		           <td >
		           	<custom:text name="details" property="prodcode" readonly="true" size="5"/>
		           	<custom:hidden  name="details" property="prodid" /><a onclick="popProduct()"><custom:button type="3" value="*"/></a>
		           	<custom:text name="details" property="prodname" readonly="true" size="21" command="notnull" label="L_Products"/>
		           </td>
                    <td >
                  <custom:text name="details" property="bunchnopassdate" dataType="date"   dataFormatName="dateformat" style="width:140px;" command="notnull" label="L_Date"/>
                      <a onclick="javascript:c.show(this,'cform.bunchnopassdate','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
                       </td>

		           <td >
		           	<custom:text name="details" property="bunchno" size="11" command="notnull" label="L_LotNumber"/>
		           </td>
		           <td >
		           	<custom:text name="details" property="supervisecode" size="11"/>
		           </td>
		           <td>
		           	<custom:text name="details" property="password" size="11" command="notnull" label="L_Password"/>
		           </td>
			     </tr>
			 	
		      <%@ include file="/inc/SummaryAction.inc" %>
		      </table>	
		      	    </td>
	           </tr>      
		      <table width="100%" cellspacing="0" cellpadding="0">
		        <tr> 
		          <td class="summary_top"></td>
		        </tr>
		        <tr>
				     <td class="td_center">
						<a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
						<%if(searchresults.size() >0 ){%>
						<a onclick="page_save()"><custom:button type="1" label="L_Save" imgsrc="delete.gif" border="0" style="width:60"/></a>
						<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
						<%} %>
					 </td>
				</tr>
		      </table>
	
	
	</table>
</form>
</body>
</html>